//*************************************************
//**	 \u529f\u80fd\uff1a\u53bb\u6389\u5b57\u7b26\u4e32\u4e24\u7aef\u7684\u7a7a\u683c
//**     \u7ed3\u679c\uff1a
//**     \u8bf4\u660e\uff1a
function trim(str){
	var i=0;
	var i2=-1;
	var chr;

	if(typeof(str)!='undefined')
	{
		if(typeof(str)!='string')
			str=str.toString();

		for(i=0;i<str.length;i++)
		{
			chr=str.charAt(i);
			if(chr!=' ')
				break;
		}
		for(i2=str.length-1;i2>=0;i2--)
		{
			chr=str.charAt(i2);
			if(chr!=' ')
				break;
		}
	}

	if(i<=i2)
	{
		return str.substring(i,i2+1);
	}
	else
	{
		return "";
	}
}
/**
 * \u83b7\u5f97\u5f53\u524d\u65e5\u671f
 */
function getDateObj(argObj){
  var tempDate=new Date();
  var tempMonth,tempYear,tempDay;
  tempYear=tempDate.getFullYear();
  tempMonth=tempDate.getMonth();
  tempDay=tempDate.getDate();
  tempMonth=tempMonth+1;
  if(trim(tempMonth).length<2){
    tempMonth="0"+tempMonth;
  }
  if(trim(tempDay).length<2){
    tempDay="0"+tempDay;
  }
  argObj.value=tempYear +"-"+ tempMonth +"-"+ tempDay;
}
/**
 * checkString
 * \u51fd\u6570\u6821\u9a8c\u5b57\u7b26\u4e32\u7684\u957f\u5ea6,\u8fd4\u56de\u7684\u503c\u4e3a\u771f\u548c\u5047,true\u548cfalse;
 * 
 * Object\u76ee\u6807\u5bf9\u8c61,Desc\u4e2d\u6587\u7684\u63cf\u8ff0,MaxLen\u5b57\u7b26\u4e32\u7684\u957f\u5ea6.
 */
function checkString(Object,Desc,MaxLen)
{
	var strValue=trim(Object.value);
	if(strValue.length==0)
	{
		return true;
	}
	else
	{
		var strLength;
		var i;
		strLength=0;
		for(i=0;i<strValue.length;i++)
		{
			 mChar=strValue.charCodeAt(i);
			if ( mChar<0 || mChar>127 )
			{
				strLength+=2;
			}
			else
			{
				strLength+=1;
			}
		}
		if(strLength>MaxLen)
		{
			alert("\u201c"+Desc+"\u201d\u7684\u957f\u5ea6\u8fc7\u957f\uff0c\u53ea\u80fd\u8f93\u5165"+MaxLen+"\u4e2a\u5b57\u7b26\u6216\u6c49\u5b57\uff0c\u8bf7\u4fee\u6539\uff01");
			Object.focus();
			return false;
		}
		else
		{
			return true;
		}
	}
}
/**
 * checkStringMin
 * \u51fd\u6570\u6821\u9a8c\u5b57\u7b26\u4e32\u7684\u957f\u5ea6,\u8fd4\u56de\u7684\u503c\u4e3a\u771f\u548c\u5047,true\u548cfalse;
 * 
 * Object\u76ee\u6807\u5bf9\u8c61,Desc\u4e2d\u6587\u7684\u63cf\u8ff0,MinLen\u5b57\u7b26\u4e32\u7684\u957f\u5ea6.
 */
function checkStringMin(Object,Desc,MinLen){
	var strValue=trim(Object.value);
	if(strValue.length==0)
	{
		alert("\u201c"+ Desc +"\u201d\u7684\u957f\u5ea6\u8fc7\u77ed\uff0c\u8bf7\u81f3\u5c11\u8f93\u5165"+ MinLen +"\u4e2a\u5b57\u7b26\u6216\u6c49\u5b57\uff0c\u8bf7\u4fee\u6539\uff01");
		Object.focus();
		return false;
	}
	else
	{
		var strLength;
		var i;
		strLength=0;
		for(i=0;i<strValue.length;i++)
		{
			 mChar=strValue.charCodeAt(i);
			if ( mChar<0 || mChar>127 )
			{
				strLength+=2;
			}
			else
			{
				strLength+=1;
			}
		}
		if(strLength<MinLen)
		{
			alert("\u201c"+ Desc +"\u201d\u7684\u957f\u5ea6\u8fc7\u77ed\uff0c\u8bf7\u81f3\u5c11\u8f93\u5165"+ MinLen +"\u4e2a\u5b57\u7b26\u6216\u6c49\u5b57\uff0c\u8bf7\u4fee\u6539\uff01");
			Object.focus();
			return false;
		}
		else
		{
			return true;
		}
	}
}
/**
 * checkFloat
 * \u51fd\u6570\u6821\u9a8c\u6b64\u6846\u8f93\u5165\u7684\u662f\u5426\u4e3afloat\u578b\u7684\u6570\u636e,\u8fd4\u56de\u7684\u503c\u4e3a\u771f\u548c\u5047,true\u548cfalse;
 * 
 * Object\u76ee\u6807\u5bf9\u8c61,Desc\u4e2d\u6587\u7684\u63cf\u8ff0.
 */
function checkFloat(Object,Desc)
{
	var strFloat=trim(Object.value);

	if(strFloat.length==0)
	{
		return true;
	}
	else
	{
		var pattern=/^(-?\d+)(\.\d+)?$/;
		if(strFloat.match(pattern)==null){
			alert("\u201c"+Desc+"\u201d\u5fc5\u987b\u4e3a\u4e00\u4e2a\u6570\u5b57\uff0c\u8bf7\u4fee\u6539\uff01");
			Object.focus();
			return false;
		}else{
			return true;
		}
	}
}

/**
 * checkInteger
 * \u51fd\u6570\u6821\u9a8c\u6b64\u6846\u8f93\u5165\u7684\u662f\u5426\u4e3aInteger\u578b\u7684\u6570\u636e,\u8fd4\u56de\u7684\u503c\u4e3a\u771f\u548c\u5047,true\u548cfalse;
 * 
 * Object\u76ee\u6807\u5bf9\u8c61,Desc\u4e2d\u6587\u7684\u63cf\u8ff0.
 */
function checkInteger(Object,Desc)
{
	var strInteger=trim(Object.value);
	if(strInteger.length==0){
		return true;
	}else{
		var pattern = /^-?\d+$/;
		if(strInteger.match(pattern)==null){
			alert("\u201c"+Desc+"\u201d\u5fc5\u987b\u4e3a\u4e00\u4e2a\u6570\u5b57\uff0c\u8bf7\u4fee\u6539\uff01");
			Object.focus();
			return false;
		}else{
			return true;
		}
	}
}
/**
 * checkMonth
 * \u51fd\u6570\u6821\u9a8c\u6b64\u6846\u8f93\u5165\u7684\u662f\u5426\u4e3a\u6b63\u786e\u7684\u6708\u4efd,\u8fd4\u56de\u7684\u503c\u4e3a\u771f\u548c\u5047,true\u548cfalse;
 * 
 * Object\u76ee\u6807\u5bf9\u8c61,Desc\u4e2d\u6587\u7684\u63cf\u8ff0.
 */
function checkMonth(Object,Desc)
{
	var strMonth=trim(Object.value);
	if(strMonth.length==0){
		return true;
	}else{
		var pattern = /^-?\d+$/;
		if(strMonth.match(pattern)==null||strMonth<=0||strMonth>12){
			alert("\u201c"+Desc+"\u201d\u5fc5\u987b\u6b63\u786e\u6708\u4efd\uff0c\u8bf7\u4fee\u6539\uff01");
			Object.focus();
			return false;
		}else{
			return true;
		}
	}
}
/**
 * checkRealInt
 * \u51fd\u6570\u6821\u9a8c\u6b64\u6846\u8f93\u5165\u7684\u662f\u5426\u4e3aInteger\u578b\u7684\u6570\u636e,\u8fd4\u56de\u7684\u503c\u4e3a\u771f\u548c\u5047,true\u548cfalse;
 * 
 * Object\u76ee\u6807\u5bf9\u8c61,Desc\u4e2d\u6587\u7684\u63cf\u8ff0.
 */
function checkRealInt(Object,Desc)
{
	var strRealInt=trim(Object.value);
	if(strRealInt.length==0){
		return true;
	}else{
                if(checkInteger(Object,Desc)){
                  if(parseInt(strRealInt,10)<0){
                    alert("\u201c"+Desc+"\u201d\u5fc5\u987b\u4e3a\u4e00\u4e2a\u6570\u5b57\uff0c\u8bf7\u4fee\u6539\uff01");
                    Object.focus();
                    return false;
                  }else{
                    return true;
                  }
                }else{
                  return false;
                }
	}
}
function checkPostCode(Object,Desc){
	var strValue=trim(Object.value);
	if(strValue.length==0){
		return true;
	}else{
		if(strValue.length!=6){
			alert("\u201c"+Desc+"\u201d\u5fc5\u987b\u4e3a\u516d\u4f4d\u7684\u6570\u5b57\uff0c\u8bf7\u4fee\u6539\uff01");
			Object.focus();
			return false;
		}else{
			var pattern=/\d/;
			if(strValue.match(pattern)==null){
				alert("\u201c"+Desc+"\u201d\u5fc5\u987b\u4e3a\u516d\u4f4d\u7684\u6570\u5b57\uff0c\u8bf7\u4fee\u6539\uff01");
				Object.focus();
				return false;
			}else{
				if(strValue.charCodeAt(0)==48){
					alert("\u201c"+Desc+"\u201d\u4e0d\u80fd\u4ee50\u5f00\u5934\u7684\u6570\u5b57\uff0c\u8bf7\u4fee\u6539\uff01");
					Object.focus();
					return false;
				}else{
				return true;
				}
			}
		}
	}
}
/**
 * checkNotNull\u51fd\u6570\u6821\u9a8c\u6b64\u6846\u8f93\u5165\u7684\u6570\u636e\u4e0d\u4e3a\u7a7a,\u8fd4\u56de\u7684\u503c\u4e3a\u771f\u548c\u5047,true\u548cfalse;
 * 
 * Object\u76ee\u6807\u5bf9\u8c61,Desc\u4e2d\u6587\u7684\u63cf\u8ff0.
 */
function checkNotNull(Object,Desc)
{
	var strValue=trim(Object.value);
	if(strValue.length==0)
	{
		alert("\u201c"+Desc+"\u201d\u4e0d\u80fd\u4e3a\u7a7a\uff0c\u8bf7\u4fee\u6539\uff01");
		Object.focus();
		return false;
	}
	else
	{
		return true;
	}
}
/**
 * checkNotNull\u51fd\u6570\u6821\u9a8c\u6b64\u6846\u8f93\u5165\u7684\u6570\u636e\u4e0d\u4e3a\u7a7a,\u8fd4\u56de\u7684\u503c\u4e3a\u771f\u548c\u5047,true\u548cfalse;
 * 
 * Object\u76ee\u6807\u5bf9\u8c61,Desc\u4e2d\u6587\u7684\u63cf\u8ff0.
 */
function checkNotNullNotObject(ID,Desc)
{
	var strValue=trim(document.all(ID).value);
	if(strValue.length==0)
	{
		alert("\u201c"+Desc+"\u201d\u4e0d\u80fd\u4e3a\u7a7a\uff0c\u8bf7\u4fee\u6539\uff01");
		document.all(ID).focus();
		return false;
	}
	else
	{
		return true;
	}
}
function checkNull(Object){
	var strValue=trim(Object.value);
	if(strValue.length==0){
		return true;
	}else{
		return false;
	}
}
/**
 * javascript\u81ea\u52a8\u7684\u6821\u9a8c\u51fd\u6570\uff08\u4e94\uff09-
 * Float\u6821\u9a8c checkEmail
 * \u51fd\u6570\u6821\u9a8c\u6b64\u6846\u8f93\u5165\u7684\u662f\u5426\u4e3aemail\u578b\u7684\u6570\u636e,\u8fd4\u56de\u7684\u503c\u4e3a\u771f\u548c\u5047,true\u548cfalse;
 * \u4f8b\u5982:xxxxxxx@hotmail.com
 * 
 * Object\u76ee\u6807\u5bf9\u8c61,Desc\u4e2d\u6587\u7684\u63cf\u8ff0.
 */
function checkEmail(Object,Desc){
	var pattern = /[a-zA-Z0-9_.]{1,}@[a-zA-Z0-9_]{1,}.[a-zA-Z0-9_]{1,}/;
	var strValue=trim(Object.value);
	if (strValue.length==0)
	return true;
	if(strValue.match(pattern)==null){
		alert("\u201c"+Desc+"\u201d\u5fc5\u987b\u4e3a\u5408\u6cd5\u7684email\uff0c\u8bf7\u4fee\u6539\uff01");
		Object.focus();
		return false;
	}else{
		var lenStr=Object.maxlength;
		if(lenStr==null){
			return true;
		}
		else{
			if(checkString(Object,Desc,lenStr)){
				return true;
			}else{
				return false;
			}
		}
	}
}

/**
 * checkDate
 * \u51fd\u6570\u6821\u9a8c\u6b64\u6846\u8f93\u5165\u7684\u662f\u5426\u4e3aDate\u578b\u7684\u6570\u636e,\u8fd4\u56de\u7684\u503c\u4e3a\u771f\u548c\u5047,true\u548cfalse;
 * \u4f8b\u5982:2005-10-10
 * 
 * Object\u76ee\u6807\u5bf9\u8c61,Desc\u4e2d\u6587\u7684\u63cf\u8ff0.
 */
function checkDate(Object,Desc)
{
	var strValue=trim(Object.value);

	if(strValue.length==0)
	{
		return true;
	}
	else
	{
		if(strValue.length<8 || strValue.length>10)
		{

			alert("\u201c"+Desc+"\u201d\u5fc5\u987b\u4e3a\u5408\u6cd5\u7684\u65e5\u671f\uff0c\u60a8\u8f93\u5165\u4e86\u4e00\u4e2a\u975e\u6cd5\u7684\u65e5\u671f\uff0c\u683c\u5f0f\u4e3a\uff1aYYYY-MM-DD\uff0c\u8bf7\u4fee\u6539\uff01");
			Object.focus();
			return false;
		}
		else
		{
			var myArray;
			myArray=strValue.split("-");
			if(myArray.length!=3)
			{
				alert("\u201c"+Desc+"\u201d\u5fc5\u987b\u4e3a\u5408\u6cd5\u7684\u65e5\u671f\uff0c\u60a8\u8f93\u5165\u4e86\u4e00\u4e2a\u975e\u6cd5\u7684\u65e5\u671f\uff0c\u683c\u5f0f\u4e3a\uff1aYYYY-MM-DD\uff0c\u8bf7\u4fee\u6539\uff01");
				Object.focus();
				return false;
			}
			else
			{
				var tempy,tempm,tempd;
				if (myArray[0].length==4)
				{
					tempy = myArray[0];
					tempm = myArray[1];
					tempd = myArray[2];
				}
				else
				{
					tempy = myArray[2];
					tempm = myArray[0];
					tempd = myArray[1];
				}
				var tDateString = parseInt(tempy,10) +"/"+ parseInt(tempm,10) +"/"+ parseInt(tempd,10) +" 8:0:0";	// \u52a0\u516b\u5c0f\u65f6\u662f\u56e0\u4e3a\u6211\u4eec\u5904\u4e8e\u4e1c\u516b\u533a
				var strDate=new Date(tDateString);
				if(isNaN(strDate))
				{
					alert("\u201c"+Desc+"\u201d\u5fc5\u987b\u4e3a\u5408\u6cd5\u7684\u65e5\u671f\uff0c\u60a8\u8f93\u5165\u4e86\u4e00\u4e2a\u975e\u6cd5\u7684\u65e5\u671f\uff0c\u683c\u5f0f\u4e3a\uff1aYYYY-MM-DD\uff0c\u8bf7\u4fee\u6539\uff01");
					Object.focus();
					return false;
				}
				else
				{
					if((strDate.getFullYear()==parseInt(tempy,10))&&(strDate.getMonth()==parseInt(tempm,10)-1)&&(strDate.getDate()==parseInt(tempd,10)))
					{
						 return true;
					}
					else
					{
						alert("\u201c"+Desc+"\u201d\u5fc5\u987b\u4e3a\u5408\u6cd5\u7684\u65e5\u671f\uff0c\u60a8\u8f93\u5165\u4e86\u4e00\u4e2a\u975e\u6cd5\u7684\u65e5\u671f\uff0c\u683c\u5f0f\u4e3a\uff1aYYYY-MM-DD\uff0c\u8bf7\u4fee\u6539\uff01");
						Object.focus();
						return false;
					}
				}
			}
		}
	}
}
/**
 * chk_isTime
 * \u51fd\u6570\u6821\u9a8c\u6b64\u6846\u8f93\u5165\u7684\u662f\u5426\u4e3aTime\u578b\u7684\u6570\u636e,\u8fd4\u56de\u7684\u503c\u4e3a\u771f\u548c\u5047,true\u548cfalse;
 * \u4f8b\u5982:10:50
 * 
 * ObjValue\u5bf9\u8c61\u7684\u503c.
 */
function chk_isTime(ObjValue){
	var m_value=new String()
	m_value=trim(ObjValue);
	if(m_value==""){
		return false;
	}else{
		var tempArray=m_value.split(":");
		if(tempArray.length>1){
		var tempNumber=new Number();
		tempNumber=tempArray[0];
		if(tempNumber>=24||tempNumber<0){
			return false;
		}else{
			tempNumber=tempArray[1];
			if(tempNumber>=60||tempNumber<0){
				return false;
			}else{
				return true;
			}
		}
		}else{
			return false;
		}
	}
}
/**
 * checkDatetime
 * \u51fd\u6570\u6821\u9a8c\u6b64\u6846\u8f93\u5165\u7684\u662f\u5426\u4e3aDatetime\u578b\u7684\u6570\u636e,\u8fd4\u56de\u7684\u503c\u4e3a\u771f\u548c\u5047,true\u548cfalse;
 * \u4f8b\u5982:2005-10-10 10:50
 * 
 * Object\u76ee\u6807\u5bf9\u8c61,Desc\u4e2d\u6587\u7684\u63cf\u8ff0.
 */
function checkDatetime(Object,Desc){
	var strValue=trim(Object.value);
	if(strValue.length==0){
		return true;
	}
	else{
		var pattern= /^\d\d\d\d-\d\d-\d\d \d\d:\d\d$/;
		if(strValue.match(pattern)==null){
			alert("\u201c"+Desc+"\u201d\u5fc5\u987b\u4e3a\u5408\u6cd5\u7684\u65e5\u671f\uff0c\u60a8\u8f93\u5165\u4e86\u4e00\u4e2a\u975e\u6cd5\u7684\u65e5\u671f\uff0c\u683c\u5f0f\u4e3a\uff1aYYYY-MM-DD HH:mm\uff0c\u8bf7\u4fee\u6539\uff01");
			Object.focus();
			return false;
		}else{
            var tempArray=strValue.split(" ");
            if(tempArray.length>1){
				if(!chk_isDate(tempArray[0])){
					alert("\u201c"+Desc+"\u201d\u5fc5\u987b\u4e3a\u5408\u6cd5\u7684\u65e5\u671f\uff0c\u60a8\u8f93\u5165\u4e86\u4e00\u4e2a\u975e\u6cd5\u7684\u65e5\u671f\uff0c\u683c\u5f0f\u4e3a\uff1aYYYY-MM-DD HH:mm\uff0c\u8bf7\u4fee\u6539\uff01");
					Object.focus();
					return false;
				}else{
					if(!chk_isTime(tempArray[1])){
						alert("\u201c"+Desc+"\u201d\u5fc5\u987b\u4e3a\u5408\u6cd5\u7684\u65e5\u671f\uff0c\u60a8\u8f93\u5165\u4e86\u4e00\u4e2a\u975e\u6cd5\u7684\u65e5\u671f\uff0c\u683c\u5f0f\u4e3a\uff1aYYYY-MM-DD HH:mm\uff0c\u8bf7\u4fee\u6539\uff01");
						Object.focus();
						return false;
					}else{
						return true;
					}
				}
            }else{
				alert("\u201c"+Desc+"\u201d\u5fc5\u987b\u4e3a\u5408\u6cd5\u7684\u65e5\u671f\uff0c\u60a8\u8f93\u5165\u4e86\u4e00\u4e2a\u975e\u6cd5\u7684\u65e5\u671f\uff0c\u683c\u5f0f\u4e3a\uff1aYYYY-MM-DD HH:mm\uff0c\u8bf7\u4fee\u6539\uff01");
				Object.focus();
				return false;
			}
		}
	}
}

/**
 * chk_isDate
 * \u51fd\u6570\u6821\u9a8c\u6b64\u6846\u8f93\u5165\u7684\u662f\u5426\u4e3aDate\u578b\u7684\u6570\u636e,\u8fd4\u56de\u7684\u503c\u4e3a\u771f\u548c\u5047,true\u548cfalse;
 * \u4f8b\u5982:2005-10-10
 * 
 * ObjValue\u5bf9\u8c61\u7684\u503c.
 */
function chk_isDate(ObjValue)
{
	var m_value=new String()
	m_value=trim(ObjValue);

	if (m_value==null)
	{
		// alert("\u201c"+Description+"\u201d\u9879\u76ee\u5fc5\u987b\u4e3a\u5408\u6cd5\u7684\u65e5\u671f\uff0c\u60a8\u8f93\u5165\u4e86\u4e00\u4e2a\u975e\u6cd5\u7684\u65e5\u671f\uff0c\u8bf7\u4fee\u6539\uff01");
		// document.all[ID].focus();
		return false;
	}

	Dilimeter='-';
	var tempy='';
	var tempm='';
	var tempd='';
	var tempArray;

	if (m_value.length<8 && m_value.length>10)
	{
		// alert("\u201c"+Description+"\u201d\u9879\u76ee\u5fc5\u987b\u4e3a\u5408\u6cd5\u7684\u65e5\u671f\uff0c\u60a8\u8f93\u5165\u4e86\u4e00\u4e2a\u975e\u6cd5\u7684\u65e5\u671f\uff0c\u8bf7\u4fee\u6539\uff01");
		// document.all[ID].focus();
		return false;
	}

	tempArray = m_value.split(Dilimeter);
	if (tempArray.length!=3)
	{
		// alert("\u201c"+Description+"\u201d\u9879\u76ee\u5fc5\u987b\u4e3a\u5408\u6cd5\u7684\u65e5\u671f\uff0c\u60a8\u8f93\u5165\u4e86\u4e00\u4e2a\u975e\u6cd5\u7684\u65e5\u671f\uff0c\u8bf7\u4fee\u6539\uff01");
		// document.all[ID].focus();
		return false;
	}

	if (tempArray[0].length==4)
	{
		tempy = tempArray[0];
		tempm = tempArray[1];
		tempd = tempArray[2];
	}
	else
	{
		tempy = tempArray[2];
		tempm = tempArray[0];
		tempd = tempArray[1];
	}
	var tDateString = parseInt(tempy,10) + '/'+ parseInt(tempm,10) + '/'+ parseInt(tempd,10) +' 8:0:0';	// \u52a0\u516b\u5c0f\u65f6\u662f\u56e0\u4e3a\u6211\u4eec\u5904\u4e8e\u4e1c\u516b\u533a
	var tempDate = new Date(tDateString);
	if (isNaN(tempDate))
	{
		// alert("\u201c"+Description+"\u201d\u9879\u76ee\u5fc5\u987b\u4e3a\u5408\u6cd5\u7684\u65e5\u671f\uff0c\u60a8\u8f93\u5165\u4e86\u4e00\u4e2a\u975e\u6cd5\u7684\u65e5\u671f\uff0c\u8bf7\u4fee\u6539\uff01");
		// document.all[ID].focus();
		return false;
	}

	if (((tempDate.getUTCFullYear()).toString()==parseInt(tempy,10)) && (tempDate.getMonth()==parseInt(tempm,10)-1) && (tempDate.getDate()==parseInt(tempd,10)))
		return true;
	else
	{
		// alert("\u201c"+Description+"\u201d\u9879\u76ee\u5fc5\u987b\u4e3a\u5408\u6cd5\u7684\u65e5\u671f\uff0c\u60a8\u8f93\u5165\u4e86\u4e00\u4e2a\u975e\u6cd5\u7684\u65e5\u671f\uff0c\u8bf7\u4fee\u6539\uff01");
		// document.all[ID].focus();
		return false;
	}

}
function checkEndTrue(StartInt,EndInt){
	if(StartInt>EndInt){
		return false;
	}else{
		return true;
	}

}
function checkStartEndDate(StartObj,EndObj,StartDesc,EndDesc){
	if(checkNull(StartObj)){return true;}
	else if(checkNull(EndObj)){return true;}
	else if(checkDate(StartObj,StartDesc)){
		if(checkDate(EndObj,EndDesc)){// start and end not null
			var tempStartArray,tempEndArray;
			tempStartArray=StartObj.value.split("-");
			tempEndArray=EndObj.value.split("-");
			var tempStartLen,tempEndLen;
			tempStartLen=parseInt(tempStartArray[0],10);
			tempEndLen=parseInt(tempEndArray[0],10);
			if(!checkEndTrue(tempStartLen,tempEndLen)){// \u5e74\u4efd\u7684\u6bd4\u8f83
				alert("\u201c"+ StartDesc +"\u201d\u4e0d\u80fd\u5927\u4e8e\u201c"+ EndDesc +"\u201d");
				StartObj.focus();
				return false;
			}else{
				if(parseInt(tempStartArray[0],10)<parseInt(tempEndArray[0],10)){
					return true;}
				tempStartLen=parseInt(tempStartArray[1],10);
				tempEndLen=parseInt(tempEndArray[1],10);
				if(!checkEndTrue(tempStartLen,tempEndLen)){// \u6708\u4efd\u6bd4\u8f83
					alert("\u201c"+ StartDesc +"\u201d\u4e0d\u80fd\u5927\u4e8e\u201c"+ EndDesc +"\u201d");
					StartObj.focus();
					return false;}
				else{
					if(parseInt(tempStartArray[1],10)<parseInt(tempEndArray[1],10)){
						return true;}
					tempStartLen=parseInt(tempStartArray[2],10);
					tempEndLen=parseInt(tempEndArray[2],10);
					if(tempStartLen>tempEndLen){// \u5929\u6570\u6bd4\u8f83
						alert("\u201c"+ StartDesc +"\u201d\u4e0d\u80fd\u5927\u4e8e\u201c"+ EndDesc +"\u201d");
						StartObj.focus();
						return false;}else{return true;}}
		    }
		}else{return true;}
	}else{return true;}
}
function validateFunction(obj){
	if(obj==null){
		if(document.forms[0])
			obj=document.forms[0];
		else
			return true;
	}
	var formElements=obj.elements;
	var iCount;
	for(iCount=0;iCount<formElements.length;iCount++){

		if(((formElements[iCount].type=="password")||(formElements[iCount].type=="text")||(formElements[iCount].type=="textarea"))&&(formElements[iCount].getAttribute("value")!=null)){
			/** begin* */
			var attrib=formElements[iCount].getAttribute("dataMessage");
			var dataLength=formElements[iCount].getAttribute("dataLength");
			var noempty=formElements[iCount].getAttribute("dataRequire");
			switch(formElements[iCount].getAttribute("dataType"))
			{
				case "month":{
					if(!checkMonth(formElements[iCount],attrib))
					return false;
					break;
				}
				case "int":{
					if(!checkInteger(formElements[iCount],attrib))
					return false;
					break;
				}
				case "date":{
					if(!checkDate(formElements[iCount],attrib)){
					return false;
					}
					break;
				}
				case "datetime":{
					if(!checkDatetime(formElements[iCount],attrib)){
					return false;
					}
					break;
				}
                case"realint":{
                    if(!checkRealInt(formElements[iCount],attrib)){
					  return false;
					}
					break;
                }
				case "email":{
					if(!checkEmail(formElements[iCount],attrib))
					return false;
					break;
				}
				case "postcode":{
					if(!checkPostCode(formElements[iCount],attrib))
					return false;
					break;
				}
				case "double":
				case "float":{
					if(!checkFloat(formElements[iCount],attrib))
					return false;
					break;
				}
				default:{
					if((dataLength!=null)&&(!checkString(formElements[iCount],attrib,dataLength)))
						return false;
					// if((formElements[iCount].minlength!=null)&&(!checkStringMin(formElements[iCount],attrib,formElements[iCount].minlength)))
						// return false;
					break;
				}
			}
			/** end* */
		}
		if((noempty!=null)&&(!checkNotNull(formElements[iCount],attrib)))
				return false;
	} 
	return true;
}
